##
##  $Header: /pub/cvsroot/mydns/doc/man/Makefile.am,v 1.7 2003/03/15 01:09:33 bboy Exp $
##

MANPAGES		=	mydns.8 \
					mydns.conf.5 \
					mydnscheck.8 \
					mydnsimport.8 \
					mydnsexport.8

EXTRA_DIST	=	README $(MANPAGES)

RUN			=	$(SHELL) @top_srcdir@/missing --run

all: man

sedfile:
	if ! test -f @SEDFILE@; then \
	   cd @top_srcdir@ && $(MAKE) sedfile; \
	fi

man: sedfile
	for f in $(MANPAGES); do \
	   $(RUN) sed -f @SEDFILE@ $$f > @DOCDIR@/$$f; \
	done

clean: restore
	for f in $(MANPAGES); do \
	   $(RM) @DOCDIR@/$$f; \
	done

install: all
	@echo; echo "***"
	@for f in $(MANPAGES); do \
	   if test -f @DOCDIR@/$$f; then \
	      instdir=$(DESTDIR)$(mandir)/man`echo $$f | sed -e 's/^.*\\.//'`; \
	      if ! test -d $$instdir; then $(INSTALL) -d $$instdir; fi; \
	      echo "***  $$f -> $$instdir/$$f"; \
	      $(INSTALL_DATA) @DOCDIR@/$$f $$instdir/$$f; \
	   fi; \
	done
	@echo "***"; echo

restore:
	@for f in $(MANPAGES); do \
	   if test -f $$f.en; then \
	      if test -z "$$header"; then \
	         echo; echo "***"; echo "***  Restoring original manual pages:"; echo "***"; \
	         header="Y"; \
	      fi; \
	      $(RM) $$f; \
	      mv $$f.en $$f; \
		   echo "***  - $$f"; \
	   fi; \
	done; if ! test -z "$$header"; then echo "***"; echo; fi

.PHONY: all sedfile man clean install restore

## vi:set ts=3:
